<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('服务地址')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            关键字：<input type="text" placeholder="关键字" name="keyWords"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('serverVisitAddress:edit')}]];
    var removeFlag = [[${@permission.hasPermi('serverVisitAddress:remove')}]];
    var prefix = ctx + "serverVisitAddress";

    $(function () {
        var options = {
            url: prefix + "/findList",
            // createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            // removeUrl: prefix + "/remove",
            // exportUrl: prefix + "/export",
            modalName: "服务地址",
            // toolbar: 'default',
            columns: [
                {
                    field: 'visitAddressId',
                    title: 'ID',
                    align: 'center',
                    visible: false
                },
                {
                    field: 'visitAddress',
                    title: '服务地址',
                    align: 'center',
                    visible: true
                },
                {
                    field: 'description',
                    title: '描述',
                    align: 'center',
                    visible: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index){
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.visitAddressId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.visitAddressId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
        //监听头工具栏事件
        // $.table.on('toolbar(default)', function(obj){
        //     var checkStatus = table.checkStatus(obj.config.id)
        //         ,data = checkStatus.data; //获取选中的数据
        //     switch(obj.event){
        //         case 'add':
        //             layer.msg('添加');
        //             break;
        //         case 'update':
        //             if(data.length === 0){
        //                 layer.msg('请选择一行');
        //             } else if(data.length > 1){
        //                 layer.msg('只能同时编辑一个');
        //             } else {
        //                 layer.alert('编辑 [id]：'+ checkStatus.data[0].id);
        //             }
        //             break;
        //         case 'delete':
        //             if(data.length === 0){
        //                 layer.msg('请选择一行');
        //             } else {
        //                 layer.msg('删除');
        //             }
        //             break;
        //     };
        // });
    });
</script>
</body>
</html>
